$(function(){
	//初始化
	init();
	bindFun();
});
var policyRef;
var contractId;
var preprintedNo;
var result;
function init(){
	policyRef = sessionStorage.policyRef;
	contractId = sessionStorage.contractId;
	$("#policyRef").html(policyRef);
	var da ={};
	da.contractId=contractId;
	padMarketing.ajaxNormal(
			"/pad_marketing/qualityCheck/initMyContent.action",
			da,
			function(data){
				result = data.result;
			}
	);
	
	
	var M = getQueryString("M");
	var O = getQueryString("O");
	var I = getQueryString("I");
	
	var N = getQueryString("N");
	var X = getQueryString("X");
	var html="";
	var num=1;
	//处理界面的数据
	if(M!=0&&M!=null){
		html+='<p class="font-18 lh-45">'+num+'.补充了财务类资料'+M+'张</p>';
		num++;
	}
	if(O!=0&&O!=null){
		html+='<p class="font-18 lh-45">'+num+'.补充了身份识别证件类资料'+O+'张</p>';
		num++;
	}
	
	if(I!=0&&I!=null){
		html+='<p class="font-18 lh-45">'+num+'.补充了内部申请表资料'+I+'张</p>';
		num++;
	}
	if(N!=0&&N!=null){
		html+='<p class="font-18 lh-45">'+num+'.补充了新业务资料'+N+'张</p>';
		num++;
	}
	if(X!=0&&X!=null){
		html+='<p class="font-18 lh-45">'+num+'.补充了客户资料'+X+'张</p>';
		num++;
	}
	$("#content").append(html);
	padMarketing.ajaxNormal(
			"/pad_marketing/qualityCheck/getProductName.action",
				{"contractId":contractId},
				function(data){
					productName =  data.PROUCT_NAME;
					agentCode = data.SL_AGENT_CODE;
					agentName = data.SL_AGENT_NAME;
					phName = data.PH_NAME;
					preprintedNo = data.PRE_PRINTED_NO;
					$("#productName").html(productName);
					$("#agentCode").html(agentCode);
					$("#agentName").html(agentName);
					$("#phName").html(phName);
					padMarketing.ajaxNormal(
							"/pad_marketing/qualityCheck/createPdf.action",
							{	'policyRef':policyRef ,
								'agentName':agentName,
								'agentCode':agentCode,
								'phName':phName,
								'html':html,
								'type':'1162',
								'contractId':contractId,
								'productName':productName},
							function(data){
									
								}
					);
				}
		);
};
function bindFun(){
	
};
//返回
function returnUrl(){
	var url = getQueryString("url");
	if(url==null){
		location.href="/pad_marketing/index/index.action";
		return;
	}
	location.href=url;
}
function next(){
	var typeList=[];
	if(result.tb=="Y"){
		typeList.push("1151");
	}
	if(result.other=="Y" || result.add=="Y"){
		typeList.push("1169");
	}
	if(result.tb=="Y" || result.other=="Y" || result.add=="Y" ){
		typeList.push("1175");
	}
	if(result.add=="Y"){
		typeList.push("1160");
		typeList.push("1163");
		typeList.push("1167");
	}
	typeList.push("1162");
	//图片全部上传
	padMarketing.ajaxNormal(
			"/pad_marketing/qualityCheck/uploadAll.action",
			{	'typeList' : typeList,
				'policyRef':policyRef,
				'preprintedNo':preprintedNo,
				'contractId':contractId},
			function(data){
					result.allOk="Y";
					padMarketing.ajaxNormal(
							"/pad_marketing/qualityCheck/updateMyContent.action",
							result,
							function(data){
								alertMsg("您的照会回复审核通过前,请随时关注照会状态,以便及时后续处理，由此带来不便,请谅解!",0,function(){
									location.href="/pad_marketing/index/index.action";
								});
							}
					);
				}
	);
}
